using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BusinessPlatform.Core;
using BusinessPlatform.Core.BusinessObject;
using BusinessPlatform.Core.BusinessObject.Mapping;
using BusinessPlatform.Core.BusinesObjectType;

namespace BusinessPlatform.Test.SalesOrder
{
    /// <summary>
    /// 销售订单
    /// </summary>
    public class SalesOrder : BusinessObjectBase, ISalesOrder, IDocument
    {
        /// <summary>
        /// 销售订单
        /// </summary>
        public override string TableName
        {
            get { return "SalesOrder"; }
        }
        #region properties

        /// <summary>
        /// 单据编号
        /// </summary>
        [PropertyMapping(FieldName = "DocEntry", DbType = typeof(Int32), IsPrimary = true)]
        public System.Int32 DocumentEntry
        {
            get { return this.GetPropertyValue<System.Int32>("DocumentEntry"); }
            set { this.SetPropertyValue<System.Int32>("DocumentEntry", value); }
        }

        /// <summary>
        /// 单据编码
        /// </summary>
        [PropertyMapping(FieldName = "DocNum", DbType = typeof(String))]
        public System.String DocumentNumber
        {
            get { return this.GetPropertyValue<System.String>("DocumentNumber"); }
            set { this.SetPropertyValue<System.String>("DocumentNumber", value); }
        }

        /// <summary>
        /// 对象
        /// </summary>
        [PropertyMapping(FieldName = "ObjType", DbType = typeof(String))]
        public System.String ObjectType
        {
            get { return this.GetPropertyValue<System.String>("ObjectType"); }
            set { this.SetPropertyValue<System.String>("ObjectType", value); }
        }

        /// <summary>
        /// 已取消
        /// </summary>
        [PropertyMapping(FieldName = "Canceled", DbType = typeof(String))]
        public BusinessPlatform.Data.Enumerator.BOYesOrNo Canceled
        {
            get { return this.GetPropertyValue<BusinessPlatform.Data.Enumerator.BOYesOrNo>("Canceled"); }
            set { this.SetPropertyValue<BusinessPlatform.Data.Enumerator.BOYesOrNo>("Canceled", value); }
        }

        /// <summary>
        /// 已关闭
        /// </summary>
        [PropertyMapping(FieldName = "Closed", DbType = typeof(String))]
        public BusinessPlatform.Data.Enumerator.BOYesOrNo Closed
        {
            get { return this.GetPropertyValue<BusinessPlatform.Data.Enumerator.BOYesOrNo>("Closed"); }
            set { this.SetPropertyValue<BusinessPlatform.Data.Enumerator.BOYesOrNo>("Closed", value); }
        }

        /// <summary>
        /// 创建人
        /// </summary>
        [PropertyMapping(FieldName = "Creator", DbType = typeof(Int32))]
        public System.Int32 Creator
        {
            get { return this.GetPropertyValue<System.Int32>("Creator"); }
            set { this.SetPropertyValue<System.Int32>("Creator", value); }
        }

        /// <summary>
        /// 创建时间
        /// </summary>
        [PropertyMapping(FieldName = "CreateDate", DbType = typeof(DateTime))]
        public System.DateTime CreateDate
        {
            get { return this.GetPropertyValue<System.DateTime>("CreateDate"); }
            set { this.SetPropertyValue<System.DateTime>("CreateDate", value); }
        }

        /// <summary>
        /// 更新人
        /// </summary>
        [PropertyMapping(FieldName = "Updator", DbType = typeof(Int32))]
        public System.Int32 Updator
        {
            get { return this.GetPropertyValue<System.Int32>("Updator"); }
            set { this.SetPropertyValue<System.Int32>("Updator", value); }
        }

        /// <summary>
        /// 更新时间
        /// </summary>
        [PropertyMapping(FieldName = "UpdateDate", DbType = typeof(DateTime))]
        public System.DateTime UpdateDate
        {
            get { return this.GetPropertyValue<System.DateTime>("UpdateDate"); }
            set { this.SetPropertyValue<System.DateTime>("UpdateDate", value); }
        }

        /// <summary>
        /// 备注
        /// </summary>
        [PropertyMapping(FieldName = "Remarks", DbType = typeof(String))]
        public System.String Remarks
        {
            get { return this.GetPropertyValue<System.String>("Remarks"); }
            set { this.SetPropertyValue<System.String>("Remarks", value); }
        }

        /// <summary>
        /// 单据状态
        /// </summary>
        [PropertyMapping(FieldName = "DocStatus", DbType = typeof(String))]
        public BusinessPlatform.Data.Enumerator.BODocStatus DocumentStatus
        {
            get { return this.GetPropertyValue<BusinessPlatform.Data.Enumerator.BODocStatus>("DocumentStatus"); }
            set { this.SetPropertyValue<BusinessPlatform.Data.Enumerator.BODocStatus>("DocumentStatus", value); }
        }

        /// <summary>
        /// 客户编码
        /// </summary>
        [PropertyMapping(FieldName = "CardCode", DbType = typeof(String))]
        public System.String CardCode
        {
            get { return this.GetPropertyValue<System.String>("CardCode"); }
            set { this.SetPropertyValue<System.String>("CardCode", value); }
        }

        /// <summary>
        /// 客户名称
        /// </summary>
        [PropertyMapping(FieldName = "CardName", DbType = typeof(String))]
        public System.String CardName
        {
            get { return this.GetPropertyValue<System.String>("CardName"); }
            set { this.SetPropertyValue<System.String>("CardName", value); }
        }

        /// <summary>
        /// 单据日期
        /// </summary>
        [PropertyMapping(FieldName = "DocDate", DbType = typeof(DateTime))]
        public System.DateTime DocDate
        {
            get { return this.GetPropertyValue<System.DateTime>("DocDate"); }
            set { this.SetPropertyValue<System.DateTime>("DocDate", value); }
        }

        /// <summary>
        /// 单据总计
        /// </summary>
        [PropertyMapping(FieldName = "DocTotal", DbType = typeof(Decimal))]
        public System.Decimal DocTotal
        {
            get { return this.GetPropertyValue<System.Decimal>("DocTotal"); }
            set { this.SetPropertyValue<System.Decimal>("DocTotal", value); }
        }

        /// <summary>
        /// 部分交货
        /// </summary>
        [PropertyMapping(FieldName = "IsPartDelivery", DbType = typeof(String))]
        public BusinessPlatform.Data.Enumerator.BOYesOrNo IsPartDelivery
        {
            get { return this.GetPropertyValue<BusinessPlatform.Data.Enumerator.BOYesOrNo>("IsPartDelivery"); }
            set { this.SetPropertyValue<BusinessPlatform.Data.Enumerator.BOYesOrNo>("IsPartDelivery", value); }
        }

        #endregion

        /// <summary>
        /// 销售订单行集合
        /// </summary>
        private ISalesOrderLines _SalesOrderLines;
        /// <summary>
        /// 销售订单行集合
        /// </summary>
        public ISalesOrderLines SalesOrderLines { get { return _SalesOrderLines; } }

        /// <summary>
        /// 销售订单构造函数
        /// </summary>
        public SalesOrder()
        {

            _SalesOrderLines = new SalesOrderLines(this);
            base.SetPropertyValue<ISalesOrderLines>("SalesOrderLines", _SalesOrderLines);

        }
    }
}
